# Maintainer: Marian Buschsieweke <marian.buschsieweke@posteo.net>
pkgname=avarice
pkgver=2.14
pkgrel=4
pkgdesc="AVaRICE interfaces with GDB and allows debugging of AVR MCUs"
url="https://github.com/avrdudes/avarice"
arch="all"
license="GPL-2.0-only"
makedepends="
	autoconf
	automake
	binutils-dev
	hidapi-dev
	libusb-compat-dev
	libusb-dev
	linux-headers
	perl
	"
depends="gdb-multiarch"
subpackages="$pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://github.com/avrdudes/avarice/archive/refs/tags/avarice-rel-${pkgver/./_}.tar.gz
	drop_keyword_unused.patch
	"

builddir="$srcdir/avarice-avarice-rel-${pkgver/./_}"

build() {
	./Bootstrap
	# gcc12 defaults to 17 which fails due to throw()
	export CXXFLAGS="$CXXFLAGS -std=c++14"
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr
	make
}

check() {
	make check
}

package() {
	make DESTDIR="$pkgdir" install
}

sha512sums="
b302e91859f0a2891c80f036430468274b327b7f9168c042748e98d00e010b180be995343a47878acf2702637b402483c494aec4fb53063d5fc2d2fe82c58f83  avarice-2.14.tar.gz
8e9faf7eab5807f3b100ba29e7aab857f91947981a25dccc3096c9462d777be9fb19cf410e8634884b3ce9299fe410e24d1cd107c4bdbf0a537b9f9322e7c627  drop_keyword_unused.patch
"
